import * as React from "react";
import CommonHOC from "pages/components/commonHOC";

const Homeforrails = React.lazy(() => import("pages/home/index"));
const PersonalCenter = React.lazy(() => import("pages/personCenter/index"));
const Message = React.lazy(() => import("pages/message/index"));
const CommonListView = React.lazy(() => import("pages/commonListView/index"));
const FileInfo = React.lazy(() => import("pages/commonListView/fileInfo"));
const SignPage = React.lazy(() => import("pages/commonListView/signTable"));
const SignTask = React.lazy(() => import("pages/signTask/index"));
const StatusFlow = React.lazy(() => import("pages/commonListView/statusFlow"));

const PreSubmit = React.lazy(() => import("pages/pre-submit/index"));
const Bidsection = React.lazy(() => import("pages/workstart-standard/index"));
const MeasureDesign = React.lazy(() => import("pages/measure-design/index"));
const ProcessDoc = React.lazy(() => import("pages/process-doc"));

export const tablePath = [
    {
        label: "施工组织设计（专项施工方案）",
        path: "PreSubmit/OrgDesign",
        children: [
            {
                label: "详情",
                path: "PreSubmit/OrgDesign/detail",
                component: PreSubmit,
            },
        ],
    },
    {
        label: "资质报审表",
        path: "PreSubmit/QualReview",
        children: [
            {
                label: "详情",
                path: "PreSubmit/QualReview/detail",
                component: PreSubmit,
            },
        ],
    },
    {
        label: "大临验收",
        path: "PreSubmit/ImpendAcceptance",
        children: [
            {
                label: "详情",
                path: "PreSubmit/ImpendAcceptance/detail",
                component: PreSubmit,
            },
        ],
    },
    {
        label: "开工报告",
        path: "PreSubmit/CommencementRepo",
        children: [
            {
                label: "详情",
                path: "PreSubmit/CommencementRepo/detail",
                component: PreSubmit,
            },
        ],
    },
    {
        label: "首件工程",
        path: "PreSubmit/FirstPiece",
        children: [
            {
                label: "详情",
                path: "PreSubmit/FirstPiece/detail",
                component: PreSubmit,
            },
        ],
    },
    {
        label: "作业指导书",
        path: "PreSubmit/WorkInstruction",
        children: [
            {
                label: "详情",
                path: "PreSubmit/WorkInstruction/detail",
                component: PreSubmit,
            },
        ],
    },
    {
        label: "人员报审",
        path: "PreSubmit/Submit",
        children: [
            {
                label: "详情",
                path: "PreSubmit/Submit/detail",
                component: PreSubmit,
            },
        ],
    },
    {
        label: "单位工程划分表",
        path: "PreSubmit/UnitProj",
        children: [
            {
                label: "详情",
                path: "PreSubmit/UnitProj/detail",
                component: PreSubmit,
            },
        ],
    },
    {
        label: "机械设备与工程材料",
        path: "PreSubmit/MachineryManagement",
        children: [
            {
                label: "详情",
                path: "PreSubmit/MachineryManagement/detail",
                component: PreSubmit,
            },
        ],
    },
    {
        label: "测量控制现场交桩纪要",
        path: "MeasureDesign/PileDelivery",
        children: [
            {
                label: "详情",
                path: "MeasureDesign/PileDelivery/detail",
                component: MeasureDesign,
            },
        ],
    },
    {
        label: "控制网评估申请",
        path: "MeasureDesign/EvaluateApplicate",
        children: [
            {
                label: "详情",
                path: "MeasureDesign/EvaluateApplicate/detail",
                component: MeasureDesign,
            },
        ],
    },
    {
        label: "施工控制测量成果报验表",
        path: "MeasureDesign/ResultsForm",
        children: [
            {
                label: "详情",
                path: "MeasureDesign/ResultsForm/detail",
                component: MeasureDesign,
            },
        ],
    },
    {
        label: "图纸会审",
        path: "MeasureDesign/DrawingAudit",
        children: [
            {
                label: "详情",
                path: "MeasureDesign/DrawingAudit/detail",
                component: MeasureDesign,
            },
        ],
    },
    {
        label: "曲线表",
        path: "MeasureDesign/CurveTab",
        children: [
            {
                label: "详情",
                path: "MeasureDesign/CurveTab/detail",
                component: MeasureDesign,
            },
        ],
    },
    {
        label: "坡度表",
        path: "MeasureDesign/SolpeTab",
        children: [
            {
                label: "详情",
                path: "MeasureDesign/SolpeTab/detail",
                component: MeasureDesign,
            },
        ],
    },
    {
        label: "断链表",
        path: "MeasureDesign/BrokenChainTab",
        children: [
            {
                label: "详情",
                path: "MeasureDesign/BrokenChainTab/detail",
                component: MeasureDesign,
            },
        ],
    },
    {
        label: "技术交底书",
        path: "MeasureDesign/TechnicalDisclosure",
        children: [
            {
                label: "详情",
                path: "MeasureDesign/TechnicalDisclosure/detail",
                component: MeasureDesign,
            },
        ],
    },
    {
        label: "原材料报验",
        path: "ProcessDoc/RawMaterial",
        children: [
            {
                label: "详情",
                path: "ProcessDoc/RawMaterial/detail",
                component: ProcessDoc,
            },
        ],
    },
    {
        label: "配合比报审",
        path: "ProcessDoc/MixRatio",
        children: [
            {
                label: "详情",
                path: "ProcessDoc/MixRatio/detail",
                component: ProcessDoc,
            },
        ],
    },
    {
        label: "现场安全质量检查记录",
        path: "ProcessDoc/Records",
        children: [
            {
                label: "详情",
                path: "ProcessDoc/Records/detail",
                component: ProcessDoc,
            },
        ],
    },
    {
        label: "工程小结",
        path: "ProcessDoc/ProjSummary",
        children: [
            {
                label: "详情",
                path: "ProcessDoc/ProjSummary/detail",
                component: ProcessDoc,
            },
        ],
    },
    {
        label: "试验总结",
        path: "ProcessDoc/TestSummary",
        children: [
            {
                label: "详情",
                path: "ProcessDoc/TestSummary/detail",
                component: ProcessDoc,
            },
        ],
    },
    {
        label: "沉降变形观测与评估",
        path: "ProcessDoc/ObservationDeformation",
        children: [
            {
                label: "详情",
                path: "ProcessDoc/ObservationDeformation/detail",
                component: ProcessDoc,
            },
        ],
    },
    {
        label: "工程技术条件表",
        path: "DeliveryofCompletion/ConditionTable",
    },
    {
        label: "车站表",
        path: "DeliveryofCompletion/StationTable",
    },
    {
        label: "路基加固及防护工程数量表",
        path: "DeliveryofCompletion/QuantityTable",
    },
    {
        label: "水准点表4-1",
        path: "DeliveryofCompletion/Table4-1",
    },
    {
        label: "标段开工标准化",
        path: "WorkStartStandard/bidsection",
        children: [
            {
                label: "详情",
                path: "WorkStartStandard/bidsection/detail",
                component: Bidsection,
            },
        ],
    },
    {
        label: "单位工程开工标准化",
        path: "WorkStartStandard/UnitProject",
        children: [
            {
                label: "详情",
                path: "WorkStartStandard/UnitProject/detail",
                component: Bidsection,
            },
        ],
    },
];

const tableRoute = tablePath.map(table => {
    return {
        label: table.label,
        path: table.path,
        component: CommonListView,
        children: table.children,
    };
});

const router = [
    {
        label: "导航",
        children: [
            {
                label: "首页",
                path: "home",
                component: Homeforrails,
            },
            {
                label: "消息",
                path: "message",
                component: Message,
            },
            {
                label: "我的",
                path: "me",
                component: PersonalCenter,
            },
            {
                label: "附件列表",
                path: "FileInfo",
                component: FileInfo,
            },
            {
                label: "审核意见",
                path: "SignMind",
                component: SignPage,
            },
            ...tableRoute,
            {
                label: "签名管理",
                path: "SignTask",
                component: SignTask,
            },
            {
                label: "流转通知",
                path: "StatusFlow",
                component: StatusFlow,
            },
        ],
    },
];

const navigations = router.map(page => {
    return {
        ...page,
        children: page.children.map(it => {
            it.component = CommonHOC(it.component);
            return {
                ...it,
            };
        }),
    };
});

export default navigations;
